*****Conscription and Military Service: Do They Result in Future Violent and Non-Violent Incarcerations and Recidivism?  Wang, Flores-Lagunes 2020*****
****This do-file prints the results for Table 8
cd "C:\Users\xinto\Dropbox\Vietnam Veteran Paper\Crime Paper\2020 JHR Data\10. Table 8"

use inmate_sample_2020, clear

*Recorde contactJuvenile
drop contactJuvenile
gen contactJuvenile=9
replace contactJuvenile=1 if (firstArrestBy18==1 | incarcerationBefore1968==1 | probationBy18==1 ) 
replace contactJuvenile=0 if (firstArrestBy18==0 & incarcerationBefore1968==0 & probationBy18==0 )
tab contactJuvenile


***Restricted to 1948-1952 male cohort**********
keep if totalSample==1 
count 
sca n_all=r(N)

*************************************************
****Generate the dummy variable to differentiate the 1948-1950 (=0) and the 1951-1952 (=1) birth cohorts
gen draftYear=9 
replace draftYear=0 if birthYear<=50
replace draftYear=1 if birthYear>=51
tab draftYear

**Whether served on or before 1970 
gen serv70=9 
replace serv70=1 if yearEnterMilitary<=70 
replace serv70=0 if yearEnterMilitary>70 
tab serv70

****Mark out the at obsrvation 
gen at=9
replace at=1 if vv==1 & eligible==0
replace at=0 if at==9 
tab at

gen nvv=. 
replace nvv=1 if vv==0 
replace nvv=0 if vv==1
tab nvv 
gen T=vv
gen Z=eligible


/* Volunteer Proportions */ 
mean at [pweight=weight] if eligible==0 & white==1, over(draftYear)
lincom [at]0-[at]1

mean at [pweight=weight] if eligible==0 & white==0, over(draftYear)
lincom [at]0-[at]1

/* Military characteristics */ 
preserve 
# delimit ;
global military="stationedVietnam sawCombat serv70"; 
# delimit cr 
/*
foreach outcome in $military  {
 keep if (`outcome'==1 | `outcome'==0)  
 }
*/
 foreach outcome in $military {
 
 foreach race in 0 1 { 
 
 di "This is the difference in `outcome' characteristic of always-takers (white=`race') bwtween 1948-1950 and 1951-1952 birth cohort" 
 
mean `outcome' [pweight=weight] if `outcome'!=9 & `outcome'!=99 & at==1 & white==`race', over(draftYear)
lincom [`outcome']0-[`outcome']1
 
             }
 
 }
restore 


/* Crime Outcomes */ 
preserve
# delimit ;
global crime1=" everUseDrug 
 contactJuvenile "; 

 global crime2=" ageFirstUseAnyDrugs
 everUseDrug useDrugBeforeCurrentOffense
 contactJuvenile "; 
 
# delimit cr 

 foreach outcome in $crime1 {
 keep if (`outcome'==1 | `outcome'==0)  
 }

 foreach outcome in $crime2 {
 
 foreach race in 0 1 { 
 
 di "This is the `outcome' characteristics of always-takers (white=`race') bwtween 1948-1950 and 1951-1952 birth cohort" 
 
mean `outcome' [pweight=weight] if `outcome'!=9 & `outcome'!=99 & `outcome'!=999 & at==1 & white==`race', over(draftYear)
lincom [`outcome']0-[`outcome']1
 
 
             }
 
 }

 restore 
 


/* Family background characteristics */ 
gen parent_served=99 
replace parent_served=1 if (motherServed==1 | fatherServed==1)
replace parent_served=0 if (motherServed==0 & fatherServed==0)
tab parent_served

replace abusedPhyBefore=99 if abusedPhyBefore==9

preserve

# delimit ;
global family="higestGradeFather parent_served abusedPhyBefore"; 
# delimit cr 

foreach outcome in  $family {
 foreach race in 0 1 { 
 
 di "This is the `outcome' characteristics of always-takers (white=`race') bwtween 1948-1950 and 1951-1952 birth cohort" 
 
mean `outcome' [pweight=weight] if `outcome'!=99 & at==1 & white==`race', over(draftYear)
lincom [`outcome']0-[`outcome']1
 
             }  
 }
restore 
























 



